package model;

import communication.Alarm;
import communication.AlarmListener;
import communication.FireAlarm;

/**
 * Fire sensor class
 * @author Adrien Ledeul
 * @version 0.1
 */
public class FireSensor extends Sensor
{
	/**
	 * Constructors
	 * 
	 */
	public FireSensor() 
	{
		super();
	}

	/**
	 * Send an alarm to listeners
	 * @param alarm Alarm
	 */
	@Override
	public void notifyListeners(Alarm alarm)
	{
		try
		{
			FireAlarm fireAlarm = (FireAlarm) alarm;
			
			for(AlarmListener al : alarmListeners)
			{
				al.receiveAlarm(fireAlarm);
			}
		}
		catch (Exception e)
		{
			System.out.println("Wrong alarm type");
		}	
	}
}
